/*
 *  MW.cpp
 *  T3nsors2
 *
 *  Created by Michael Barriault on 10-06-28.
 *  Copyright 2010 University of Guelph. All rights reserved.
 *
 */

#include "MW.h"
#include <cmath>
#include <iostream>
using namespace t3;
using std::cout;
using std::endl;

MW::MW(domain* O, double K, double epsilon) {
	cout << "Allocating variables" << endl;
	this->O = O->retain();
	this->K = K;
	this->epsilon = epsilon;
	this->rho = scalar::init(O,"rho");
	this->J = vector::init(O,3,"J");
	this->x = vector::init(O,3,"x");
	this->Phi = scalar::init(O,"Phi");
	this->Psi = scalar::init(O,"Psi");
	this->E = vector::init(O,3,"E");
	this->B = vector::init(O,3,"B");
	
	FORALL(this->O) {
		this->x->c(0)->pt(i,j,k) = O->min(0) + i*O->d(0);
		this->x->c(1)->pt(i,j,k) = O->min(1) + j*O->d(1);
		this->x->c(2)->pt(i,j,k) = O->min(2) + k*O->d(2);
	}
}

MW::~MW() {
	cout << "Deallocating solution" << endl;
	O->release();
	x->release();
	Phi->release();
	Psi->release();
	E->release();
	B->release();
	rho->release();
	J->release();
}


